#include <stdio.h>
#include <string.h>
int cmp_int(const void* e1, const void* e2)
{
	return (*(int*)e1) - (*(int*)e2);
}
void swap(char* buf1, char* buf2, int width)
{
	for (int i = 0; i < width; i++)
	{
		char tmp = *buf1;
		*buf1 = *buf2;
		*buf2 = tmp;
		buf1++;
		buf2++;
	}
}
void Bubble_sort(void* arr,int width,int sz,int(*cmp_int)(const void* e1,const void* e2))
{
	for (int i = 0; i < sz - 1; i++)
	{
		for (int j = 0; j < sz - 1 - i; j++)
		{
			if (cmp_int((char*)arr + j * width, (char*)arr + (j + 1) * width) > 0)
			{
				swap((char*)arr + j * width, (char*)arr + (j + 1) * width, width);
			}
		}
	}
}
int main()
{
	char str[] = "asdksahdkhaskf";
	int sz1 = strlen(str);
	Bubble_sort(str,1, sz1, cmp_int);
	int arr[] = { 1,5,1,7,1,98,1,35,1564,154,2,3,70 };
	int sz2 = sizeof(arr) / sizeof(arr[0]);
	Bubble_sort(arr, sizeof(arr[0]), sz2, cmp_int);
	for (int i = 0; i < sz2; i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
	printf("%s ", str);
}